<template>
  <div class='resume-container'>
    <!-- <div class="resume-head">
      <h3 class="common-title">岗位信息</h3>
      <div class="resume-head-info">
        <div class="resume-head-item">
          <p>应聘单位: 黄石市城发集团</p>
          <el-divider direction="vertical"></el-divider>
          <p>岗位: 黄石市城发集团</p>
          <el-divider direction="vertical"></el-divider>
          <p>招聘人数: 10</p>
          <el-divider direction="vertical"></el-divider>
          <p>学历要求: 本科</p>
          <el-divider direction="vertical"></el-divider>
          <p>工作年限要求: 5年</p>
        </div>
      </div>
    </div> -->
    <div class="resume-content">
      <h3 class="common-title">投递人简历</h3>
      <div class="base-info">
        <img v-if="resumeInfo.userHead" :src="apiHost + resumeInfo.userHead" alt="">
        <div class="base-wrap" style="display: flex;">
          <div class="base-info-item" style="margin-left: 16px;">
            <p class="name">{{ resumeInfo.userName }}</p>
            <p>{{ resumeInfo.userSex === 1 ? '男' : '女' }}·{{ userAge + '岁' }}·{{ resumeInfo.userEducation }}·{{ resumeInfo.workYear + '年经验'  }}</p>
            <p>{{ resumeInfo.userPhone }}</p>
            <p>{{ resumeInfo.userEmail }}</p>
            <p>{{ resumeInfo.identityCard }}</p>
          </div>
          <div class="base-info-item">
            <p>出生年月: {{ resumeInfo.birthTime }}</p>
            <p>最高学历: {{ resumeInfo.userEducation }}</p>
            <p>毕业院校: {{ resumeInfo.userSchool }}</p>
            <p>专业: {{ resumeInfo.userMajor }}</p>
            <p>参加工作时间: {{ resumeInfo.workTime }}</p>
            
          </div>
          <div class="base-info-item">
            <p>工作经验: {{ resumeInfo.workYear }}年</p>
            <p>在校入学时间: {{ resumeInfo.enrolTime }}</p>
            <p>期望薪资: {{ resumeInfo.hopeSalary }}</p>
          </div>
        </div>
      </div>
      <!-- <div class="info-wrap">
        <p class="sub-title">求职意向</p>
        <div>
          <span>卜卦算命</span>
          <span>100-200</span>
        </div>
        <div class="lebels">
          <span>全职</span>
          <span>全职</span>
          <span>全职</span>
          <span>全职</span>
        </div>
      </div> -->
      <div class="info-wrap">
        <p class="sub-title">个人简介</p>
        <p>{{ resumeInfo.userBlurb }}</p>
      </div>
      <div class="info-wrap">
        <p class="sub-title">工作经历</p>
        <div class="experience-item" v-for="item in resumeInfo.userResumeDetailList" :key="item.id">
          <div style="font-weight: 600;">{{ item.companyName }}</div>
          <div>
            <span>{{ item.stationName }}</span>
            <span style="margin-left: 12px;">{{ item.entryTime }} ~ {{ item.resignTime }}</span>
          </div>
          <div>
            工作描述：<p v-html="item.jobDesc"></p>
          </div>
        </div>
      </div>
      <div class="info-wrap">
        <p class="sub-title">附件</p>
        <div class="file-wrap">
          <p style="color: #1890ff;cursor: pointer;text-decoration: underline" @click="handleDownload">{{ resumeInfo.fileName }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { api_host } from '../../../settings'
export default {
  props: {
    resumeData: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      resumeInfo: {}
    };
  },
  computed: {
    apiHost() {
      return process.env.VUE_APP_BASE_API
    },
    userAge() {
      var birthDate = this.resumeInfo.birthTime.split('-')[0]
      return new Date().getFullYear() - Number(birthDate)
    }
  },
  watch: {
    resumeData: {
      handler(newObj, oldObj) {
        if (newObj?.id) {
          this.resumeInfo = newObj
          console.log(newObj, 'newObj')
        }
      },
      immediate: true,
      deep: true
    }
  },
  methods: {
    handleDownload() {
      window.open(this.apiHost + this.resumeData.attachment)
    }
      
  },
  created() {
    if (process.env.NODE_ENV === "development") {
      console.log("开发环境")
    }
  },
  mounted() {

  },
  components: {},
}
</script>

<style lang='scss' scoped>
.common-title {
  font-size: 18px;
  font-weight: 600;
  color: #000;
  margin: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid #DCDFE6;
}

.resume-head {
  margin-bottom: 30px;
}

.resume-head-info {
  margin-top: 10px;
}

.resume-head-item {
  display: flex;

  p {
    margin: 0;
  }
}

.resume-content {
  .base-info {
    display: flex;
    margin-top: 16px;

    img {
      width: 160px;
      height: 160px;

    }

    .base-info-item {
      margin-right: 50px;

      .name {
        font-size: 16px;
        font-weight: 600;
      }

      p {
        margin-bottom: 16px;
      }
    }


  }

  p {
    padding: 0;
    margin: 0;
  }
}

.resume-container .sub-title {
  font-size: 18px;
  font-weight: 600;
  color: #000;
  margin-top: 16px;
  margin-bottom: 8px;
}

.experience-item {
  margin-bottom: 12px;
  border-bottom: 1px solid #DCDFE6;

  &:last-child {
    border-bottom: 0;
  }
}

.el-divider--vertical {
  height: 16px;
  background-color: #999;
}
</style>